1. Field of the Invention
The present invention relates to image-capturing devices such as digital cameras and digital video cameras, image-processing devices, and methods for controlling the image-capturing devices. These image-capturing devices and image-processing devices have a function for detecting a predetermined region of a subject.
2. Description of the Related Art
In known image-capturing devices, techniques for automatically detecting a predetermined region of a shot image of a subject and performing various types of processing on the detected region have been proposed.
In Japanese Patent Laid-Open No. 2003-107335, a technique for performing automatic focusing (hereinafter called AF) on a detected face region of a subject and shooting an image is disclosed. A technique for performing automatic exposure (hereinafter called AE) based on luminance values of a detected face region to properly adjust the face region and shooting an image is also disclosed.
FIG. 9 is a flowchart showing a shooting operation of a known digital camera including a face-detecting module.
This digital camera performs optimal AF and AE on a face region detected by the face-detecting module.
In step S221, a CPU in the digital camera detects that a shooting person half-presses a shutter button, i.e., a switch SW1 is turned on. In step S222, the CPU determines whether an electric view finder (hereinafter called EVF) display is turned on. When the CPU determines that the EVF display is turned on, the process proceeds to step S223. When the CPU determines that the EVF display is turned off, the process proceeds to step S224.
When the EVF display is turned on, in step S223, an AE-control circuit sets a diaphragm value (hereinafter called Av), a shutter speed (hereinafter called Tv), and an analog gain (hereinafter called Sv) to obtain an image for detecting a face. These values, determined at the time when an image to be displayed on the EVF is obtained just before the switch SW1 is turned on, are used.
In a case where the EVF display is turned off, after the switch SW1 is turned on, in step S224, the AE-control circuit performs a preliminary shooting under preset exposure conditions: Av, Tv, and Sv.
In step S225, the AE-control circuit resets Av, Tv, and Sv to shoot an image for detecting a face based on image signals obtained by the preliminary shooting in step S224.
In step S226, the AE-control circuit shoots a first image with Av, Tv, and Sv, which are set in step S223 or S225.
In step S227, the CPU inputs signals of the first image obtained in step S226 to a face-detecting circuit to obtain data about a face, for example, coordinates of a face region and reliability of face detection. When a face region is detected in step S227, in step S229, the CPU sets a light metering frame and a focusing frame for the face region detected in step S227. On the other hand, when a face region is not detected in step S227, in step S230, the CPU outputs a message that face detection failed and sets a light metering frame and a focusing frame on a predetermined region.
In step S231, an AF-control circuit performs automatic focusing based on image signals within the focusing frame set in step S229 or S230.
In step S232, the CPU performs shooting of a second image to obtain exposure conditions for actual shooting as of the time when automatic focusing is completed.
In step S233, the AE-control circuit sets Av, Tv, and Sv for actual shooting by performing calculations so that the weighting of luminance values of the light metering frame is increased based on signals of the second image. The shooting person is notified that automatic exposure is completed by displaying the light metering frame on the EVF.
When the shooting person fully presses the shutter button, i.e., a switch SW2 is turned on, in step S234, in step S235, the CPU performs actual shooting with Av, Tv, and Sv set in step S233.
In step S236, the CPU extracts luminance signals, color signals, and the like from signals of the actual shot image. An image-conversion circuit converts these signals to general-purpose image signals, for example, image signals compressed in compliance with a JPEG compression format.
In step S237, the CPU records the image signals converted in step S236 on a recording medium.
Next, a typical algorithm of face detection in a general-purpose face-detecting module is briefly described.
Bandpass filtering that lets through signals within a specific frequency band is first performed on image signals subjected to face detection, in the vertical direction as shown in FIG. 11A and in the horizontal direction as shown in FIG. 11B, to detect edge components in the image signals.
Then, pattern matching is performed on the detected edge components to extract image data of parts characterizing a face, for example, eyes, a nose, a mouth, and ears.
Among pieces of the extracted image data likely to correspond to eyes, those that satisfy predetermined conditions, for example, the distance between eyes and the inclination of each eye, are selected as a valid combination of pieces of image data likely to correspond to eyes.
The linkage between the selected valid combination of pieces of image data likely to correspond to eyes and the corresponding image data of parts forming a face, for example, a nose, a mouth, and ears, is established, and these pieces of image data are filtered with predetermined conditions for filtering out image data other than a face region to detect a face region.
These predetermined filtering conditions are compared with pieces of image data that are likely to correspond to a face region to determine that these pieces of image data are not those of a face region when this comparison does not satisfy a predetermined evaluation value.
However, a known image-capturing device having a face-detecting function may occasionally fail to detect a face region, especially in a case of a back-lighted scene as shown in FIG. 10. This is because, even in a case where exposure is appropriate in view of overall image signals, exposure of a face region that should be a main subject may be insufficient or excessive depending on the size, the location, and the like of a face that is a subject.
Moreover, when the size of a detected face is much larger or smaller than a predetermined pattern used in pattern matching, the accuracy in detecting a face region may decrease. Thus, a face may not be detected.
Moreover, in a face-detecting module that detects a pair of eyes based on image signals subjected to face detection, bandpass filtering is performed in the horizontal and vertical directions. When the value of inclination of a face with respect to one direction of bandpass filtering does not fall in a range of ±15°, the accuracy of face detection may significantly decrease.
In the operation flow described above, when face detection fails in step S227, a message indicating the failure is displayed in step S230. Thus, the user may view the message and may retry face detection. Specifically, the switch SW1 needs to be first turned off, and be again turned on after a layout is changed in view of the luminance, the size, and the inclination of the subject.
In actual shooting, the period between the time of pushing the shutter of the image-capturing device and the time when an image is captured (hereinafter called a shutter time lag) should be short. However, when automatic detection of a main subject fails due to the reasons described above, detection of the main subject needs to be repeated, thereby extending the shutter time lag.
Accordingly, the accuracy of automatic detection of a main subject needs to be improved regardless of conditions of the main subject, for example, the size and the inclination of the main subject.